package edu.neusoft.yiqibike.common.thread;

import edu.neusoft.yiqibike.common.entity.mysql.Admin;
import edu.neusoft.yiqibike.common.entity.mysql.OperationLog;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * User：lyc
 * Date：2017-12-11
 * Time：11:59
 * Description：异步日志
 */
@Slf4j
@Component
public class AsyncLogImpl extends BaseAsyncLog {
    @Override
    protected void setOperatorId(HttpServletRequest httpServletRequest, OperationLog operationLog) {
        Admin admin = (Admin) SecurityUtils.getSubject().getPrincipal();
        operationLog.setUid(admin.getId());
    }
}
